# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=libnbd
pkgver=1.18.1
pkgrel=0
pkgdesc="NBD client library in userspace"
url="https://gitlab.com/nbdkit/libnbd"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	autoconf
	automake
	bash-completion-dev
	gnutls-dev
	libtool
	libxml2-dev
	linux-headers
	perl
	python3-dev
	"
checkdepends="qemu-img bash python3"
subpackages="$pkgname-dev $pkgname-doc $pkgname-bash-completion"
source="
	https://download.libguestfs.org/libnbd/${pkgver%.*}-stable/libnbd-$pkgver.tar.gz
	"

# secfixes:
#   1.18.0-r0:
#     - CVE-2023-5215
#   1.14.1-r0:
#     - CVE-2022-0485
#   1.10.5-r0:
#     - CVE-2021-20286

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--disable-golang
	make
}

check() {
	make check
}

package() {
	make DESTDIR=$pkgdir install
}

sha512sums="
f4262666be55d580550e053355f14f80d352bf869ae7241e9fa032a9b5cd9e027eb89a536871c1206422413fc7ed745da7d612b3e1413f76ec17168705fbf12c  libnbd-1.18.1.tar.gz
"
